<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>

	<body>
		<div class="btn">
			<a href="#a">跳转至id=a</a>
			<a href="#b">跳转至id=b</a>
			<a href="#c">跳转至id=c</a>
			<a href="#d">跳转至id=d</a>
		</div>
		<div id="box">
			<div id="a" style="background: palegoldenrod">a</div>
			<div id="b" style="background: paleturquoise">b</div>
			<div id="c" style="background: peru">c</div>
			<div id="d" style="background: plum">d</div>
		</div>

		<style>
			* {
				/* 平滑滚动 */
				scroll-behavior: smooth;
			}

			#box div {
				width: 50%;
				height: 500px;
				margin-top: 100px;
				font-size: 100px;
				color: #fff;
				display: flex;
				justify-content: center;
				align-items: center;
			}

			.btn {
				position: fixed;
				top: 100px;
				left: 60%;
			}

			.btn a {
				margin: 0 10px;
			}
		</style>
	</body>
</html>
